﻿using System;
using System.IO;
using System.IO.Pipes;

class PipeServer
{
    static void Main()
    {
        using (NamedPipeServerStream pipeStream = new NamedPipeServerStream("testpipe"))
        {

            pipeStream.WaitForConnection();

            using (StreamWriter writer = new StreamWriter(pipeStream))
            {
                writer.AutoFlush = true;
                string temp;

                while ((temp = Console.ReadLine()) != "stop")
                {
                    writer.WriteLine(temp);
                }
            }
        }
    }
}